<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title><#if title?has_content>${title} - 用户中心 - ${sitename}<#else>${sitename} - 用户中心 </#if></title>
<link rel="icon" type="image/png" href="${base}/images/favicon.ico" />
<link media="all" href="${base}/ui/puerh/css/puerh.all.css" rel="stylesheet">
<link media="all" href="${template_url}/style/ucenter.css" rel="stylesheet">
<@m.widget path="/script/script_variable" cache=false />
<script type="text/javascript" src="${base}/script/jquery.js"></script>
<script type="text/javascript" src="${base}/script/jquery.form.js"></script>
<script type="text/javascript" src="${template_url}/script/ucenter.common.js"></script>
</head>

<body style="background-color:#fff;">
	<#if id?exists>
		<div id="form">
			<div id="msg" style="display:none;color: #C00;padding: 3px 3px 3px 20px;"></div>
			<form name="commentForm" id="commentForm" action="${spaceUrl}/admin/comment/reply/do" method="POST">
				<input type="hidden" name="id" value="${id}" />
				<textarea name="content" id="content" class="input" style="width:350px;height:100px;"></textarea>
				<input type="submit" value="提交" class="button pull-right" style="margin-top:2px;"/>
			</form>
		</div>
		<div id="success" style="display:none;text-align:center">
			留言发表成功,<a href="javascript:closeit();">关闭窗口</a>
		</div>
	<#else>
		<div style="text-align:center;color:red;">
			初始化留言窗口失败。
		</div>
	</#if>
</body>
<script type="text/javascript">
	function closeit(){
		var api = frameElement.api;
		var W = api.opener;
		api.close();
		top.location.reload()
	}
	
	function showMsg(msg){
		$('#msg').html(msg);
		$('#msg').fadeIn();
	}
	
	$(document).ready(function(){
		$('#commentForm').ajaxForm({
			success : function(response){
				if(response.success){
					setTimeout(closeit, 2000);
					$('#form').css('display', 'none');
					$('#success').css('display', 'block');
				}
				else {
					alert(response.message);
				}
			}
		});
		
		
		$('#content').ctrlEnter(function(){
			$('#commentForm').submit();
		});
	});
</script>
</html>